package com.heima.feigns;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.Date;

@FeignClient(value = "leadnews-wemedia",    // 服务名称
        fallbackFactory = WemediaFeignFallback.class,  // 服务降级实现类
        configuration = HeimaFeignAutoConfiguration.class)  // feign配置类  日志级别
public interface WemediaFeign {
    @GetMapping("/api/v1/user/findByName/{name}")
    public ResponseResult<WmUser> findByName(@PathVariable String name);
    @PostMapping("/api/v1/user/save")
    public ResponseResult<WmUser> save(@RequestBody WmUser user);

    @GetMapping("/api/v1/news/one/{id}")
    public ResponseResult<WmNews> findWmNewsById(@PathVariable("id") Integer id);

    @PutMapping("/api/v1/news/update")
    ResponseResult updateWmNews(@RequestBody WmNews wmNews);

    @GetMapping("/api/v1/user/findById/{id}")
    ResponseResult<WmUser> findById(@PathVariable("id") Integer id);


    @GetMapping("/api/v1/news/findUserId/{articleId}")
    public ResponseResult<Integer> findUserId(@PathVariable("articleId") Long articleId);
}
